package com.main.by.service.impl;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.main.by.dao.CateDao;
import com.main.by.entity.vo.AdminLoginVO;
import com.main.by.entity.vo.CateVO;
import com.main.by.service.CateService;

@Service
public class CateServiceImpl implements CateService{
	
	private static Logger logger = Logger.getLogger(CateServiceImpl.class);
	
	@Autowired
	private CateDao cateDao;

	@Override
	public List<CateVO> findAllCate(HttpServletRequest request) throws Exception {
		logger.info("查询数据库");
		return  cateDao.findAllCate();
	}

	@Override
	public boolean addCate(String cateName) throws Exception {
		return  cateDao.addCate(cateName);
	}
	
	@Override
	public CateVO findCateById(int cateId) throws Exception {
		logger.info("查询分类数据库");
		return  cateDao.findCateById(cateId);
	}
	
	@Override
	public boolean updateCateMethod(CateVO cateInfo) throws Exception {
		logger.info("修改分类");
		return  cateDao.updateCateById(cateInfo);
	}
	
	@Override
	public boolean deleteCateById(int cateId) throws Exception {
		logger.info("查询管理员数据库");
		return  cateDao.deleteCateById(cateId);
	}
}
